<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>foword</button>
    <button>back</button>
    <button>go</button>
    <script>
        var btns = document.getElementsByTagName('button')
        btns[0].addEventListener('click',function(e){
            alert(1)
            history.forward()
        })
        btns[1].addEventListener('click',function(e){
            history.back()
        })
        btns[2].addEventListener('click',function(e){
            // 正数 前进两次
            history.go(2)
        })
    </script>
</body>
</html>